
#ifdef _UNIT_TEST

#include "3DType.h"
#include <cppunit/extensions/HelperMacros.h>


class TestMath : public CppUnit::TestFixture
{
	CPPUNIT_TEST_SUITE( TestMath );
		CPPUNIT_TEST( test_is_zero );
		CPPUNIT_TEST( test_is_equal );
	CPPUNIT_TEST_SUITE_END();

public:

	void setUp() 
	{
		//test construction
	}
	void tearDown() 
	{
		//test destruction
	}

	void test_is_zero()
	{
		CPPUNIT_ASSERT( is_zero( precision - precision/10 ) );
		CPPUNIT_ASSERT( is_zero( -precision + precision/10 ) );
	}

	void test_is_equal()
	{
		CPPUNIT_ASSERT( is_equal(0 - precision/10, 0 - precision/10 ) );
		CPPUNIT_ASSERT( !is_equal(0 - precision/10*9, 0 + precision/10*9 ) );
		CPPUNIT_ASSERT( is_equal(1000 - precision/10, 1000 - precision/10 ) );
		CPPUNIT_ASSERT( is_equal(1000 - precision*100, 1000 + precision*100 ) );
		CPPUNIT_ASSERT( !is_equal(1000 - precision*1000, 1000 + precision*1000 ) );
	}

};

CPPUNIT_TEST_SUITE_REGISTRATION( TestMath );


#endif